/*********************************************************************************
 *      Copyright:  (C) 2024 LingYun<iot25@lingyun>
 *                  All rights reserved.
 *
 *       Filename:  get_time.c
 *    Description:  This file 
 *                 
 *        Version:  1.0.0(07/12/24)
 *         Author:  LingYun <iot25@lingyun>
 *      ChangeLog:  1, Release initial version on "07/12/24 17:37:50"
 *                 
 ********************************************************************************/
#include <time.h>
#include "get_time.h"

void get_time(char *time_buf,size_t buf_size)
{
	time_t		raw_time;
	struct tm	*time_info;

	//获取当前时间
	time(&raw_time);

	//将时间转换为本地时间
	time_info = localtime(&raw_time);

	//格式化时间输出的格式为“YYYY-MM-DD HH:MM:SS”
    strftime(time_buf,buf_size,"%Y-%m-%d %H:%M:%S",time_info);

}
